

let Slider = require('../src/uis/ui_ext');
let UI = require('../src/uis/ui');

// require('bootstrap');

let editor,map,controller;
let animEditor;
window.onload = function () {
   console.log(`ssss`);

   document.body.style.width = `${window.innerWidth}px`;
   document.body.style.height = `${window.innerHeight}px`;
   window.addEventListener('resize',()=>{
      document.body.style.width = `${window.innerWidth}px`;
      document.body.style.height = `${window.innerHeight}px`;
   },false);

   return;
   editor = new UI.Div();
   editor.setWidth(window.innerWidth);
   editor.setHeight(window.innerHeight);
   editor.setBackgroundColor('gray');
   document.body.appendChild(editor.dom);
   window.addEventListener('resize',onResize,false);

   map = new UI.Div();
   map.setWidth('50%');
   map.setHeight('70%');
   map.setBackgroundColor('cyan');
   editor.add(map);

   controller = new UI.Div();
   controller.setWidth('50%');
   controller.setHeight('70%');
   controller.setBackgroundColor('yellow');
   controller.setPositionStyle('absolute');
   controller.setLeft('50%');
   controller.setTop(0);
   editor.add(controller);


   animEditor = new UI.Div();
   animEditor.setBackgroundColor('red');
   animEditor.setWidth('100%');
   animEditor.setHeight('30%');
   // animEditor.setMarginLeft('20px');
   editor.add(animEditor);

   let btn = new UI.Button('收起');
   btn.onClick(()=>{
      // console.log(animEditor.dom.style.width);
      console.log(`offsetHeight:`,btn.dom.offsetHeight);
      console.log(`offsetLeft:`,btn.dom.offsetLeft);
      console.log(`offsetParent:`,btn.dom.offsetParent);
      console.log(`offsetTop:`,btn.dom.offsetTop);
      console.log(`offsetWidth:`,btn.dom.offsetWidth);
      console.log(`getLeft:`,btn.getLeft());
   });
   animEditor.add(btn);
   btn.setPositionStyle('relative');
   btn.setLeft('90%');
};

function onResize() {
   console.log(`resize called!`);
   editor.setWidth(window.innerWidth);
   editor.setHeight(window.innerHeight);
}
